package com.liukz.controller;

import com.liukz.annotation.LKZAutowried;
import com.liukz.annotation.LKZController;
import com.liukz.annotation.LKZRequestMapping;
import com.liukz.annotation.LKZRequestParam;
import com.liukz.service.TestService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 　　* @description: 接收请求Controller
 *     请求地址：http://localhost/springMvcLKZ/liukz/test?name=LKZ
 * 　　* @author liukz
 * 　　* @date 2019/5/16
 *
 */
@LKZController
@LKZRequestMapping("/liukz")
public class TestController {

    @LKZAutowried
    private TestService testService;

    @LKZRequestMapping("/test")
    public void myTest(HttpServletRequest request, HttpServletResponse response,
                       @LKZRequestParam("name") String name) {
        try {
            response.getWriter().write("TestController:the name is :" + name);
            testService.printName(name);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
